﻿@using System.Globalization
@using System.Web.Optimization
@using VocaDb.Model.Domain.Globalization
@using VocaDb.Model.Helpers
@using VocaDb.Web.Helpers
@using VocaDb.Model.Utils
@using VocaDb.Web.Code
@inherits VocaDbPage
	
@{
	var stylesheet = Login.IsLoggedIn && !string.IsNullOrEmpty(Login.User.Stylesheet) ? Login.User.Stylesheet : Config.SiteSettings.DefaultStylesheet;
}

<!DOCTYPE html>
<html lang="@InterfaceLanguage.GetAvailableLanguageCode(CultureInfo.CurrentUICulture)">
<head>
    <title>@(!string.IsNullOrEmpty(PageProperties.PageTitle) ? PageProperties.PageTitle + " - " : "")@BrandableStrings.Layout.SiteTitle</title>
	<meta name="description" content="@PageProperties.SummarizedDescription" />	
	<meta name="keywords" content="@BrandableStrings.Layout.Keywords" />
	<meta name="og:image" content="@PageProperties.OpenGraph.Image"/>
	<meta name="viewport" content="width=device-width, initial-scale=1">
	@* Default encoding in ASP.NET is UTF-8: https://msdn.microsoft.com/en-us/library/system.web.configuration.globalizationsection.responseencoding.aspx *@
	<meta charset="utf-8" />
	
	@{ Html.RenderPartial("LayoutPartials/_TwitterCard", Model); }

	<link rel="shortcut icon" href="@(Config.Assets.FavIconUrl.EmptyToNull() ?? Url.Content("~/Content/favicon.ico"))" type="image/x-icon" />
	@Styles.Render("~/Content/css")
	@if (!string.IsNullOrEmpty(stylesheet)) {
		<link href="@Url.Content("~/Content/Styles/" + stylesheet)" rel="stylesheet" type="text/css" />			
	}
	<link href="@Url.Content("~/Content/Styles/Icons.css")" rel="stylesheet" type="text/css" />	
	<link href="@Url.Content("~/Content/themes/redmond/jquery-ui-1.10.1.custom.min.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Scripts/qTip/jquery.qtip.css")" rel="stylesheet" type="text/css" />
	<link rel="search" type="application/opensearchdescription+xml" title="@BrandableStrings.Layout.SiteName" href="@Config.SiteSettings.OpenSearchPath" />
	
	<!-- prevent flashing content while loading the page -->
	<style type="text/css">
		.js-cloak { visibility: hidden; }
    </style>
	<noscript>
		<style type="text/css">
			.js-cloak { visibility: visible; }
		</style>		
	</noscript>

	@RenderSection("Head", false)
	
	@{ Html.RenderPartial("Partials/_GoogleAnalytics"); }

</head>

	<body class="vdb">
		  
	    <div data-bind="stopBinding" class="navbar navbar-inverse navbar-fixed-top">
		    <div class="navbar-inner">
			    <div id="topBar" class="container">
				    @{ Html.RenderPartial("GlobalSearchBox", new VocaDb.Web.Models.GlobalSearchBoxModel(PageProperties.GlobalSearchType, string.Empty)); }
			    </div>
		    </div>
	    </div>
	
		<div class="container-fluid">
			<div class="row-fluid">
				@{ Html.RenderPartial("Partials/_LeftMenu"); }

				<div class="span10 rightFrame well">
                    
							@if (ViewBag.Parents != null) {
		   var arr = (MvcHtmlString[])ViewBag.Parents;
								<ul class="breadcrumb">
								@foreach (var link in arr) {
									<li>
										@link 
										@if (link != arr.Last()) {
											<span class="divider">/</span>
		  }
									</li>
		}
								</ul>
	   }
                                        
							@if (!string.IsNullOrEmpty(PageProperties.Title)) {
								<h1 class="page-title">@PageProperties.Title
								@if (!string.IsNullOrEmpty(ViewBag.Subtitle)) {
									<small>&nbsp;@ViewBag.Subtitle</small>
		}
								</h1>
	   }
                    
                            @if (Login.Manager.LockdownEnabled) {
                                <div class="alert">
                                    @AppConfig.LockdownMessage
                                </div>
                            }
							
							@if (!string.IsNullOrEmpty(Config.SiteSettings.SitewideAnnouncement)) {
								<div class="alert">
									@Html.Raw(Config.SiteSettings.SitewideAnnouncement)
								</div>
							}								

							@if (IsSectionDefined("Toolbar")) {
								<p>
									@RenderSection("Toolbar")
								</p>
	   }
				
		
                            <div id="messages">
                                <div class="wrapper">
                                    <div id="ajaxLoadingMessage" style="display: none;">@ViewRes.SharedStrings.Loading</div>

								    <div id="errorMessage" class="alert alert-error" style="display: none;">
									    <a class="close" data-dismiss="alert" href="#">&times;</a>
									    <span id="errorMessageString">@TempData.ErrorMessage()</span>
								    </div>

                                    <div id="successMessage" class="alert alert-success" style="display: none;">
                                        <a class="close" data-dismiss="alert" href="#">&times;</a>
                                        <span id="successMessageString">@TempData.SuccessMessage()</span>
                                    </div>
                                    
                                    <div id="warnMessage" class="alert" style="display: none;">
                                        <a class="close" data-dismiss="alert" href="#">&times;</a>
                                        <span id="warnMessageString">@TempData.WarnMessage()</span>
                                    </div>
                                </div>
                            </div>
                                                            		
							@if (!string.IsNullOrEmpty(TempData.StatusMessage())) {
								@Helpers.NotificationPanel(TempData.StatusMessage())
							}
		
							@RenderBody()
					
						<div id="loginPopup" title="@ViewRes._LayoutStrings.LogIn" style="display: none;">
						</div>

				</div>
			</div>  
		</div>
			
        <!-- Footer -->	
		@{ Html.RenderPartial("Partials/_Footer"); }

	    @{ Html.RenderPartial("Partials/_LayoutScripts"); }
        
        <!-- Page-specific scripts -->
	    @RenderSection("BodyScripts", false)
	</body>
</html>
